package com.huidao.ui;

import java.util.Scanner;


import com.huidao.service.LoginService;
import com.huidao.service.RegistService;
import com.huidao.service.VipCardService;

/**
 * 收银员界面
 * 
 * @author Administrator
 *
 */
public class CashierMenu extends Menu {
	private static Scanner sc = new Scanner(System.in);
	private static final int STOP = 1;
	private static final int REGIST = 1;
	private static final int LOGIN = 2;
	private static final int BUY = 1;
	private static final int FOOD = 2;
	private static final int VIP = 3;

	public void show() {
		super.show();
		System.out.println("--------------欢迎进入三千食客收银员操作系统------------");
		System.out.println("注册请按1，继续操作请按2，其他数字表示退出系统！");
		int num = sc.nextInt();
		switch (num) {
		case REGIST: {
			System.out.println("------欢迎登陆用户注册界面-----");
			System.out.println("请输入您要注册的角色：1代表普通用户，2代表收银员");
			int status = sc.nextInt();
			new RegistService().regist(status);
			this.show();
			break;
		}
		case LOGIN: {
			System.out.println("请输入您的操作：1-->点餐，2-->对菜品或套餐操作,3-->会员卡充值");
			int operation = sc.nextInt();
			switch (operation) {
			case BUY: {
				while(true){
					System.out.println("停止收银员界面操作请输入1");
					if (sc.nextInt() == STOP ) {
						break;
					}
				// 用户登陆
				new LoginService().login(1);
				// 进入用户的菜单
				new UserMenu().show();
				}
				break;
			}
			case FOOD: {
				while(true){
					System.out.println("停止收银员界面操作请输入1");
					if (sc.nextInt() == STOP ) {
						break;
					}
					// 进入菜品和套餐的操作界面
					new FoodMenu().operation();
				}
				break;
			}

			case VIP: {
				while(true){
					System.out.println("停止收银员界面操作请输入1");
					if (sc.nextInt() == STOP ) {
						break;
					}
				// 会员卡操作界面
				new VipCardMenu().operation();
				}
			}
			default:
				break;
			}
		}
		default:
			break;
		}
	}
}
